package com.jcl.recruit.timer.crawler.service;

import com.jcl.recruit.resume.model.ResumeOrig;
import com.jcl.recruit.timer.crawler.bean.JxBean;
import com.jcl.recruit.timer.crawler.constants.CrawlerChannelConstants;
import com.jcl.recruit.timer.crawler.service.impl.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName CrawlerChannelResumeFactory
 * @Description TODO
 * @Author yyliu
 * @Date 2018/10/30 15:59
 * @Version 1.0
 **/
@Component
public class CrawlerChannelResumeProxy {



    public JxBean crawlerJxBean(String type, List<ResumeOrig> resumeOrigList){
        JxBean jxBean = null;
        CrawlerChannelResumeJx crawlerChannelResumeJx = createCrawlerChannelResume(type);
        try {
            jxBean = crawlerChannelResumeJx.crawlerResume(resumeOrigList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return jxBean;
    }

    private CrawlerChannelResumeJx createCrawlerChannelResume(String type){
        CrawlerChannelResumeJx crawlerChannelResume = null;
        if(CrawlerChannelConstants.CHANEL_BOSS.equals(type)){
            crawlerChannelResume = new BossCrawlerResumeTask();
        }else if(CrawlerChannelConstants.CHANEL_DAJIE.equals(type)){
            crawlerChannelResume = new DajieCrawlerResumeTask();
        }else if(CrawlerChannelConstants.CHANEL_HOUNT.equals(type)){
            crawlerChannelResume = new HunterCrawlerChannelResume();
        }else if(CrawlerChannelConstants.CHANEL_LAGOU.equals(type)){
            crawlerChannelResume = new LagouCrawlerResumeTask();
        }else if(CrawlerChannelConstants.CHANEL_ZHAOPIN.equals(type)){
            crawlerChannelResume = new ZhaopinCrawlerResumeTask();
        }
        return crawlerChannelResume;
    }
}
